<?php
//kurs/usob/lesson/user_lesson.php
  function les_operator(){
  $ret='';
  $fun = $_REQUEST['op'];
    switch ($fun){
      case 'usrkur': $ret = load_usr_kur();break;
      case 'getles': $ret = get_lesson_file();break;

   }
   return $ret;
   }

function get_lesson_file(){
global $wpdb; $prefix = "kuar";
$newmar = $_REQUEST['par'];
if(strlen($newmar)>0){
  $idsql = "SELECT a.path,a.filename, b.kur_path FROM ".$prefix."_zz_kurs_files as a, ".$prefix."_zz_kurs as b WHERE a.fid='$newmar' AND a.kid=b.kid";
 $file_ar = $wpdb->get_results($idsql,ARRAY_A);

 //$file .=  $file_ar[0]['kur_path']."/".$file_ar[0]['path']."/".$file_ar[0]['filename']."/?idf=".$marar[$i]."@@";
 //$panel .= $file_ar[0]['kur_path']."/".$file_ar[0]['path']."/odd/odd_~".$marar[$i].'.html'."@@";
 //}
 $file = $file_ar[0]['kur_path']."/".$file_ar[0]['path']."/".$file_ar[0]['filename'];

 //$file = substr($file,0,strlen($file)-2);
 //$panel = substr($panel,0,strlen($panel)-2);
  return "{file:'".$file."',panel:'".$panel."'}";

 }else{
     return "{file:'last.html',panel:'ood_last.html'}";
 }
 }
?>